home *** CD-ROM | disk | FTP | other *** search
- <?xml version="1.0" encoding="utf-8" ?>
- <!DOCTYPE stack PUBLIC "-//Apple, Inc.//DTD stack V 2.0//EN" "" >
- <stack>
- <name>in</name>
- <id>-1</id>
- <cardCount>2</cardCount>
- <cardID>3233</cardID>
- <listID>2830</listID>
- <cantModify><false /></cantModify>
- <cantDelete><false /></cantDelete>
- <cantAbort><false /></cantAbort>
- <cardSize>
- <width>512</width>
- <height>342</height>
- </cardSize>
- <script>on domenu menu -- Script added by Animatrix 7/14/89
- global RPstackname,RPcardname
- if menu is in "Home,Quit HyperCard" then
- if RPstackname is not empty then
- answer "This will return to "&RPStackname&"."
- set cursor to watch
- lock screen
- go card RPcardname of stack RPstackname
- unlock screen with dissolve
- exit domenu
- else pass domenu -- if RPstackname is empty
- else
- pass domenu -- if menu is not in home or quit
- end if
- end domenu
-
- on openStack
- defineStruct
- set the lineSize to 1
- set the pattern to 1
- show message at 22,300
- end openStack
-
- on closeStack
- put empty into message
- set the pattern to 12
- end closeStack
-
- on openCard
- global rootNode, searchPath, pathLength
- if the number of card fields > 0 then
- put the id of card field 1 into rootNode
- else
- put 0 into rootNode
- end if
- put empty into searchPath
- put 0 into pathLength
- walkTree
- end openCard
-
- on deleteCard
- global searchPath, pathLength
- put empty into searchPath
- put 0 into pathLength
- end deleteCard
-
- on closeCard
- undoPlot
- put empty into field treeList
- end closeCard
-
- on defineStruct
- global rootRect, rootLoc, hSpacing, vSpacing, rootLevel
- put "241,148,271,163" into rootRect
- put "256,155" into rootLoc
- put "16,32,64,128" into hSpacing
- put "30,30,30,30" into vSpacing
- put 4 into rootLevel
- end defineStruct
-
- on eraseTree
- global rootNode, seachPath, pathLength
- choose select tool
- drag from 0,0 to 512,342
- doMenu "Clear Picture"
- choose field tool
- repeat with i = the number of card fields down to 1
- click at the loc of card field i
- doMenu "Clear Field"
- end repeat
- put 0 into rootNode
- put empty into searchPath
- put 0 into pathLength
- choose browse tool
- end eraseTree
-
- on initPlot targetNode
- global searchPath, pathLength
- undoPlot
- put targetNode into line 1 of searchPath
- put the loc of card field id targetNode into¬
- line 2 of searchPath
- put 2 into pathLength
- set the style of card field id targetNode to shadow
- set the lineSize to 2
- choose line tool
- end initPlot
-
- on termPlot
- set the lineSize to 1
- choose browse tool
- end termPlot
-
- on pathPlot targetNode
- global searchPath, pathLength
- if targetNode ≠ 0 then
- add 1 to pathLength
- put targetNode into line pathLength of searchPath
- add 1 to pathLength
- put the loc of card field id targetNode into¬
- line pathLength of searchPath
- set the style of card field id targetNode to shadow
- drag from line pathLength - 2 of searchPath to¬
- line pathLength of searchPath
- end if
- end pathPlot
-
- on undoPlot
- global searchPath, pathLength
- if pathLength > 0 then
- choose line tool
- put line 1 of searchPath into targetNode
- set the style of card field id targetNode to rectangle
- put line 2 of searchPath into parentLoc
- put 3 into pathIndex
- repeat while pathIndex < pathLength
- put line pathIndex of searchPath into targetNode
- add 1 to pathIndex
- get line pathIndex of searchPath
- add 1 to pathIndex
- set the style of card field id targetNode to rectangle
- set the lineSize to 2
- drag from parentLoc to it with optionKey
- set the lineSize to 1
- drag from parentLoc to it
- put it into parentLoc
- end repeat
- put empty into searchPath
- put 0 into pathLength
- choose browse tool
- end if
- end undoPlot
-
- function searchTree key
- global rootNode, rootLevel
- global parentSide, parentNode, parentLevel, targetNode
- put 0 into parentSide
- put 0 into parentNode
- put rootLevel + 1 into parentLevel
- if rootNode = 0 then
- put 0 into targetNode
- return "missing"
- else
- initPlot rootNode
- if key = line 1 of card field id rootNode then
- put rootNode into targetNode
- return "found"
- end if
- end if
- put rootNode into parentNode
- put rootLevel into parentLevel
- put 0 into targetNode
- repeat while true
- get line 1 of card field id parentNode
- if key < it then
- put 2 into parentSide
- get line 2 of card field id parentNode
- if it ≠ 0 then
- pathPlot it
- if key = line 1 of card field id it then
- put it into targetNode
- return "found"
- else
- put it into parentNode
- subtract 1 from parentLevel
- end if
- else
- return "missing"
- end if
- else
- if key > it then
- put 3 into parentSide
- get line 3 of card field id parentNode
- if it ≠ 0 then
- pathPlot it
- if key = line 1 of card field id it then
- put it into targetNode
- return "found"
- else
- put it into parentNode
- subtract 1 from parentLevel
- end if
- else
- return "missing"
- end if
- end if
- end if
- end repeat
- end searchTree
-
- function newNode nodeLoc
- global rootRect
- choose field tool
- doMenu "New Field"
- get the number of card fields
- get the id of card field it
- set the rect of card field id it to rootRect
- set the loc of card field id it to nodeLoc
- set the style of card field id it to rectangle
- set the textFont of card field id it to geneva
- set the textSize of card field id it to 9
- set the textAlign of card field id it to center
- set the lockText of card field id it to true
- put 0 into line 2 of card field id it
- put 0 into line 3 of card field id it
- return it
- end newNode
-
- function getNodeLoc parentSide, parentNode, parentLevel
- global rootLoc, hSpacing, vSpacing
- if parentNode = 0 then
- return rootLoc
- else
- put the loc of card field id parentNode into nodeLoc
- get item parentLevel of vSpacing
- add it to item 2 of nodeLoc
- get item parentLevel of hSpacing
- if parentSide = 2 then
- subtract it from item 1 of nodeLoc
- else
- add it to item 1 of nodeLoc
- end if
- return nodeLoc
- end if
- end getNodeLoc
-
- function makeNode parentSide, parentNode, parentLevel
- global rootLoc
- if parentNode = 0 then
- get newNode( rootLoc )
- initPlot it
- return it
- else
- put getNodeLoc( parentSide, parentNode, parentLevel ) into nodeLoc
- get newNode( nodeLoc )
- put it into line parentSide of card field id parentNode
- choose line tool
- pathPlot it
- return it
- end if
- end makeNode
-
- function insertNode key
- global rootNode, parentSide, parentNode, parentLevel
- get searchTree( key )
- if it = "found" then
- termPlot
- return "duplicate"
- end if
- if parentLevel = 0 then
- termPlot
- return "full"
- end if
- put makeNode( parentSide, parentNode, parentLevel ) into theNode
- put key into line 1 of card field id theNode
- if parentNode = 0 then put theNode into rootNode
- termPlot
- return "inserted"
- end insertNode
-
- on moveSubTree parentSide, parentNode, parentLevel, nextNode
- if nextNode ≠ 0 then
- put the loc of card field id nextNode into oldLoc
- put getNodeLoc( parentSide, parentNode, parentLevel ) into newLoc
- set the loc of card field id nextNode to newLoc
- get line 2 of card field id nextNode
- if it ≠ 0 then
- drag from oldLoc to the loc of card field id it with optionKey
- moveSubTree 2, nextNode, parentLevel - 1, it
- end if
- get line 3 of card field id nextNode
- if it ≠ 0 then
- drag from oldLoc to the loc of card field id it with optionKey
- moveSubTree 3, nextNode, parentLevel - 1, it
- end if
- if parentNode ≠ 0 then
- drag from the loc of card field id parentNode to newLoc
- end if
- end if
- end moveSubTree
-
- function removeNode parentSide, parentNode, parentLevel, targetNode
- global rootNode
- put line 1 of card field id targetNode into key
- if line 2 of card field id targetNode = 0 then
- put line 3 of card field id targetNode into nextNode
- else
- put line 2 of card field id targetNode into nextNode
- end if
- choose line tool
- if parentNode ≠ 0 then
- drag from the loc of card field id parentNode to¬
- the loc of card field id targetNode with optionKey
- set the lineSize to 1
- end if
- if nextNode ≠ 0 then
- drag from the loc of card field id targetNode to¬
- the loc of card field id nextNode with optionKey
- end if
- choose field tool
- click at the loc of card field id targetNode
- doMenu "Clear Field"
- if parentNode ≠ 0 then
- put nextNode into line parentSide of card field id parentNode
- end if
- if targetNode = rootNode then put nextNode into rootNode
- choose line tool
- moveSubTree parentSide, parentNode, parentLevel, nextNode
- return key
- end removeNode
-
- on findNext
- global parentSide, parentNode, parentLevel, targetNode
- put "Looking for the successor to node" &&¬
- line 1 of card field id targetNode into message
- put 3 into parentSide
- put targetNode into parentNode
- subtract 1 fr